<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>管理员登录</title>
    <link rel="shortcut icon" href="">
    <link href="../../rs/css/bootstrap.min.css" rel="stylesheet">
    <link href="../../rs/css/style.min862f.css" rel="stylesheet">
    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->
    <script>if(window.top != window.self){ window.top.location = window.location;}</script>
    <script src="../../rs/js/common_qj.js"></script>
</head>

<body class="gray-bg">
    <div class="middle-box text-center loginscreen  animated fadeInDown">
        <div>
            <div>
                  
                <h1 class="logo-name">DY</h1>
            </div>
            <h3>欢迎使用 DY</h3>
            <form class="m-t" role="form" id="validation-form" action="" onSubmit="return false">
                <div class="form-group">
                    <input type="text" name="bh" class="form-control" placeholder="用户名"   >
                </div>
                <div class="form-group">
                    <input type="password" name='mm' class="form-control" placeholder="密码" required="">
                </div>
                <button class="btn   block full-width m-b login"style="background: #1c84c6;color:#fff">登 录</button>
            </form>
        </div>
    </div>
<script src="../../rs/js/jquery.min.js"></script>
<script src="../../rs/js/bootstrap.js"></script>
<script src="../../rs/plugins/layer/layer.js"></script>
<script src="../../rs/js/jquery.cookie.js"></script>
<script src="../../rs/js/common_qj.js"></script>
<script type="text/javascript">
    function GetRequest() {
        var url = location.search; //获取url中"?"符后的字串
        var str = "";
        if (url.indexOf("?") != -1) {
            str = url.substr(1);
        }
        return str;
    }
     var cobh=GetRequest();
    $(function(){
        $(".login").click(function(){
            var bh=$("input[name='bh']").val();
            var mm=$("input[name='mm']").val();
            if (!f_valid()) return;
            layer.load(2);
            $.post(G_url+"login/signin", "cobh="+cobh+"&bh="+bh+"&mm="+mm, function(data) {
                var ret = JSON.parse(data);//将 JSON 字符串转换成对象
                var bh=$("input[name='bh']").val();
                var user= ret.user;
                if(ret.ok){
                   // 存储 cookie
                    $.cookie('sign', ret.sign);
                    //存储bh的明文
                    $.cookie('bh',bh);
                    //存储mc的明文
                    $.cookie('mc', user.mc);

                    window.location.href = "index.php";
                }else {
                    layer.closeAll();
                    layer.msg(ret.msg);
                }
            });
        });

    });

    var f_valid = function(){
        var bh = $.trim($("input[name='bh']").val()) ;
        if( bh =='') {
            layer.msg('请输入用户编号');
            return false;
        }

        var mm = $.trim($("input[name='mm']").val()) ;
        if( mm =='') {
            layer.msg('请输入用户密码');
            return false;
        }
        return true;
    };





</script>

</body>


</html>
